I am getting an error while executing write.csv(captaincy,"NewCaptaincy")
Title
Question
I am getting the following error while executing write.csv(captaincy,"NewCaptaincy.csv")
Error in file(file, ifelse(append, "a", "w")) :
cannot open the connection
In addition: Warning message:
In file(file, ifelse(append, "a", "w")) :
cannot open file 'NewCaptaincy.csv': Permission denied
Please advise.
Thank you
R Introduction-to-Data-Frames-in-R 07-08 min 10-20 sec
Answers:
This might be a permission issue on your computer. Please look at https://stackoverflow.com/questions/17156445/why-i-get-this-error-writing-data-to-a-file for debugging this issue.
I am getting the following error while executing write.csv(captaincy,"NewCaptaincy.csv")
Error in file(file, ifelse(append, "a", "w")) :
cannot open the connection
In addition: Warning message:
In file(file, ifelse(append, "a", "w")) :
cannot open file 'NewCaptaincy.csv': Permission denied
The solution to above error is as below:
Go to RHS of R Studio Window & Locate Files (The tabs mentioned there are Files, Plots, Packages, Help, Viewer)
Click on Files
By default the location of file directory is C:/windows/system32 followed by ...
Click the ... after the file name
It will show the file path where you want to save the file (I Chose it as below)
I first created a folder named My Project on Desktop, Thereafter I chose the file path by clicking on ... on R Studio as C:/Users/Desktop/My Project
Thereafter, click on Settings icon just above ... & select set as working directory
Thereafter, execute the command write.csv(captaincy,"NewCaptaincy.csv")
OR
In console window type:
setwd("C:/Users/Desktop/My Project") & press enter & execute your command write.csv(captaincy,"NewCaptaincy.csv")
The above solution worked for me, if anyone faces the same error, kindly give it a try.
Thank you...!!!
Login to add comment